<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <div id="div1">我是一个div</div>

        <input type="button" value="点击打开一个窗口" onclick="f1()">
        <input type="button" value="打开窗口" onclick="openWin()" />
        <input type="button" value="打开窗口" onclick="open_win()">
        <a onclick="window.open('http://www.runoob.com', '_blank  ', 'location=no,titlebar=no,height=570,width=520,scrollbars=no,status=no');">
        点我在新窗口打开页面
        </a>
        <br>
        <a onclick="window.open('http://www.runoob.com', '_blank');">
        点我在新标签页打开页面
        </a>
        
           <button onclick="openwindow()">打开窗口</button>
            <button onclick="myFunction()">设置窗口</button>
            <button onclick="moveFunction()">移动窗口</button>
            <button onclick="closeFunction()">关闭窗口</button>
        
    </body>
    <script>
        function f1() {
            let specs;
            let replace;
            window.open('my-iframe.html', 'sub', specs, replace);
        }

        function openWin() {
            myWindow = window.open('', '', { titlebar:'no', toolbar:'no', location:'no', directories:0, status:0, menubar:0, 
            scrollbars:0, resizable:0, copyhistory:0, width:200,height:100});
            myWindow.document.write("<p>这是'我的窗口'</p>");
            myWindow.focus();
        }

        //window对象表示一个浏览器窗口或一个框架 window对象是全局对象, 就如同Java.lang 包 
        //要引用当前窗口根本不需要特殊的语法，可以把那个窗口的属性当作全局变量 来使用。例如，可以只写document，而不必写window.document
        let user1 = {
            name: "abc",
            age: 22
        };
        console.log(window.document.getElementById("div1"));
        console.log(window.innerHeight + ":" + window.innerWidth);
        window.name = 'w';
        console.log(window.name);

        function open_win() {
            
            window.open("http://www.runoob.com", "_blank",
                "toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, copyhistory=0, width=400, height=400"
            );
        }
        
        
          var w;
            function openwindow() {
                w = window.open('','','width=500,height=500');
            }
            function myFunction() {
                w.resizeTo(300,300);
                w.focus();
            }
            function moveFunction() {
                w.moveTo(500,500);
                w.focus();
            }
            function closeFunction() {
                w.close(500,500);
                w.focus();
         
            }
    </script>













</html>
